﻿using System;
using System.Net;
using System.Xml.Linq;
using System.Linq;

namespace ArmoryBrowser.Entities
{
    public class BaseStats
    {
        #region Fields
        private Strength _strengthField;
        private Agility _agilityField;
        private Stamina _staminaField;
        private Intellect _intellectField;
        private Spirit _spiritField;
        private Armor _armorField;
        #endregion
        #region Properties
        public Strength Strength
        {
            get
            {
                return this._strengthField;
            }
            set
            {
                this._strengthField = value;
            }
        }
        public Agility Agility
        {
            get
            {
                return this._agilityField;
            }
            set
            {
                this._agilityField = value;
            }
        }
        public Stamina Stamina
        {
            get
            {
                return this._staminaField;
            }
            set
            {
                this._staminaField = value;
            }
        }
        public Intellect Intellect
        {
            get
            {
                return this._intellectField;
            }
            set
            {
                this._intellectField = value;
            }
        }
        public Spirit Spirit
        {
            get
            {
                return this._spiritField;
            }
            set
            {
                this._spiritField = value;
            }
        }
        public Armor Armor
        {
            get
            {
                return this._armorField;
            }
            set
            {
                this._armorField = value;
            }
        }
        #endregion
        #region Constructor
        public BaseStats(XElement element)
        {
            Strength = element.Elements("strength").Select(e => new Strength(e)).FirstOrDefault();
            Agility = element.Elements("agility").Select(e => new Agility(e)).FirstOrDefault();
            Stamina = element.Elements("stamina").Select(e => new Stamina(e)).FirstOrDefault();
            Intellect = element.Elements("intellect").Select(e => new Intellect(e)).FirstOrDefault();
            Spirit = element.Elements("spirit").Select(e => new Spirit(e)).FirstOrDefault();
            Armor = element.Elements("armor").Select(e => new Armor(e)).FirstOrDefault();
        }
        #endregion
    }
}
